const joi = require("joi");

const id = joi.required();
const name = joi
  .string()
  .required()
  .pattern(
    /^(?:[\u4e00-\u9fa5]+)(?:·[\u4e00-\u9fa5]+)*$|^[a-zA-Z0-9]+\s?[\.·\-()a-zA-Z]*[a-zA-Z]+$/
  );
const email = joi
  .string()
  .pattern(/[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$/)
  .required();

const account = joi.required(); 
// 密码验证
const oldPassword = joi.string().min(6).max(12).required();
const newPassword = joi.string().min(6).max(12).required();
exports.name_limit = {
  body: {
    id,
    name,
  },
};
exports.email_limit = {
  body: {
    id,
    email,
  },
};

exports.password_limit = {
  body: {
    id,
    oldPassword,
    newPassword,
  },
};

exports.verifyAccountAndEmail_limit = {
  body: {
    account,
    email,
  },
};

exports.forgetPassword_limit = {
  body: {
    id,
    newPassword,
  },
};
